<template>
  <div class="login-container">
    <div class="login-content">
      <div class="login-form-container">
        <div class="platform-switch">
          <button
            :class="{ active: selectedPlatform === '360评测' }"
            @click="switchPlatform('360评测')"
          >
            360评测
          </button>
          <button
            :class="{ active: selectedPlatform === '干部画像' }"
            @click="switchPlatform('干部画像')"
          >
            干部画像
          </button>
          <button
            :class="{ active: selectedPlatform === '入职助手' }"
            @click="switchPlatform('入职助手')"
          >
            入职助手
          </button>
        </div>
        <form @submit.prevent="login" class="login-form">
          <h2 class="form-title">登录 {{ selectedPlatform }}</h2>
          <div class="form-group">
            <label for="username">用户名:</label>
            <input type="text" id="username" v-model="username" required />
          </div>
          <div class="form-group">
            <label for="password">密码:</label>
            <input type="password" id="password" v-model="password" required />
          </div>
          <button type="submit" class="login-button">登录</button>
        </form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: '',
      password: '',
      selectedPlatform: '360评测'
    };
  },
  methods: {
    login() {
      // 在这里处理登录逻辑，例如通过 API 进行身份验证
      console.log(`Logging in to ${this.selectedPlatform}...`, this.username, this.password);
    },
    switchPlatform(platform) {
      this.selectedPlatform = platform;
      // 可以在这里根据选定的平台更新相关登录信息
    }
  }
};
</script>

<style scoped>
.login-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
   background: url('/src/assets/bg.jpg') center/cover;
}

.login-header {
  background-color: #0097c5;
  color: white;
  text-align: center;
  padding: 20px;
}

.login-title {
  margin: 0;
  font-size: 1.5rem;
}

.login-content {
  display: flex;
  flex: 1;
  position: relative;
}


.login-form-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.platform-switch {
  display: flex;
  gap: 10px;
}

.platform-switch button {
  padding: 8px;
  background-color: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

.platform-switch button.active {
  background-color: #fff;
  color: #333;
}

.platform-switch button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.login-form {
  width: 30rem;
  padding: 20px;
  color: #fff;
  background-color: rgba(255,255,255,0.25);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease-in-out;
}

.form-title {
  text-align: center;
  margin-bottom: 20px;
  color: #fff;
  font-size: 1.5rem;
}

.form-group {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
}

label {
	flex: 0.8;
  margin-bottom: 5px;
  font-size: 12px;
      font-weight: bold;
  color: #fff;
}

input {
	flex: 4;
  padding: 12px;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.login-button{
	width: 100%;
}
button {
  padding: 12px;
  background: linear-gradient(to right, #0097c5, #00b8f0);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease-in-out;
}

button:hover {
  background: linear-gradient(to right, #00b9f1, #0097c5);
}
</style>
